/*
    Dilu_C.h - C Library for Dilu intelligent vehicle code.
    Created by PINPINWA. 2024.04.24
    Released into pubilic domain
*/

#ifndef DILU_C_H
#define DILU_C_H
#include <Arduino.h>
#include <Wire.h>


class Dilu_C
{
  public:

  uint8_t  LEFT  = 0;
  uint8_t  RIGHT = 1;
  uint8_t  ALL = 2;
  uint8_t  CW    = 0;
  uint8_t  CCW   = 1;
  
  #define  ON  HIGH
  #define  OFF LOW
  #define  LEFT 0
  #define  RIGHT 1
  #define  ALL 2
  #define  CW 0
  #define  CCW 1
  #define  FORWARD 0
  #define  BACKWARD 1
  #define  TURNLEFT 2
  #define  TURNRIGHT 3
  #define  SERVO1 1
  #define  SERVO2 2

  Dilu_C();
  ~Dilu_C();

  void    motorRun(int index, int direction, int speed),
          motorStop(int index),
          diluRun(int index,int speed),
          toggleLED(int index, int toggle),
          setServoAngle(int index, int angle);
          //servo(int index, int angle);

  int getIrStatus();
  boolean  isIrStatus(int status);
  //float e2t1UltraDis();
  uint16_t e2t1UltraDis();

  private:

  void   i2cWriteBuffer(int addr, unsigned char *p, int len);
};


#endif


/*/jueying code------------------------------
# ifndef Jueying_h
# define Jueying_h

# include "Arduino.h"

class Jueying {
    private:
        /* data /
    public:
        void initialPin();
        void setRightMotor(int dir, int speed);
        void setLeftMotor(int dir, int speed);
        void motorRun(int index, int dir, int speed);
        void jueyingRun(int index, int speed);
        void motorStop(int index);
        float e9t8UltraDis();
        int getIrStatus(int thValue);
        boolean isIrStatus(int status, int thValue);
        int getJoystickData();
        boolean isJsBtnPressed(int jsbtn);
        
};

#endif
jueying code -----------------------------*/